using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using THSERP.BusinessEntities;
using THSERP.BaseProvider;
namespace THSERP.Modules.BranchStatistics
{
    public partial class ARInvoiceItemsGridControl : THSGridControl
    {
        protected override DevExpress.XtraGrid.Views.Grid.GridView InitializeGridView()
        {
            DevExpress.XtraGrid.Views.Grid.GridView gridView = base.InitializeGridView();
            gridView.OptionsView.ShowFooter = true;

            DevExpress.XtraGrid.Columns.GridColumn col = gridView.Columns["ARInvoiceItemNetAmount"];
            col.SummaryItem.FieldName = "ARInvoiceItemNetAmount";
            col.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
            col.SummaryItem.DisplayFormat = "Total = {0:n2}";

            col = gridView.Columns["ARInvoiceItemTotalCost"];
            col.SummaryItem.FieldName = "ARInvoiceItemTotalCost";
            col.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
            col.SummaryItem.DisplayFormat = "Total = {0:n2}";

            gridView.SortInfo.Add(new DevExpress.XtraGrid.Columns.GridColumnSortInfo(gridView.Columns["ARInvoiceItemProductQty"], DevExpress.Data.ColumnSortOrder.Descending));
            return gridView;
        }

        protected override string GetLookupTableDisplayColumn(string strLookupTableName)
        {
            switch (strLookupTableName)
            {
                case "ICProducts":
                    return "ICProductNo";
                default:
                    return base.GetLookupTableDisplayColumn(strLookupTableName);
            }
        }
    }
}
